var bubble=(list)=>{
    for(var i=0,j=list.length;i<j;i++){
        console.log('i:',i);
        for(var m=0;m<j-i-1;m++){
            if(list[m]>list[m+1]){
                var temp=list[m];
                list[m]=list[m+1];
                list[m+1]=temp;
            }
        }
        console.log(list);
    }
    return list;
};

console.log(bubble([7,2,5,8,0,3,9,6,1,4]));